class Solution {
public:
    int findnum(vector<int>& nums, int target)
    {
        int left = 0;
        int right = nums.size() - 1;
        int ret = nums.size();
        while (left <= right)
        {
            int mid = left + (right - left) / 2;
            if (nums[mid] >= target)
            {
                ret = mid;
                right = mid - 1;
            }
            else
            {
                left = mid + 1;
            }
        }
        return ret;
    }
    int searchInsert(vector<int>& nums, int target) {
        int ret = findnum(nums, target);
        return ret;
    }
};